<?php

/**
 * StaffTransfer form base class.
 *
 * @method StaffTransfer getObject() Returns the current form's model object
 *
 * @package    erp-dnict
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseStaffTransferForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                      => new sfWidgetFormInputHidden(),
      'staff_id'                => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Staff'), 'add_empty' => false)),
      'old_gov_organization_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('OldGovOrganization'), 'add_empty' => false)),
      'new_gov_organization_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('NewGovOrganization'), 'add_empty' => false)),
      'old_job_title'           => new sfWidgetFormInputText(),
      'new_job_title'           => new sfWidgetFormInputText(),
      'start_date'              => new sfWidgetFormDate(),
      'document_id'             => new sfWidgetFormInputText(),
      'is_active'               => new sfWidgetFormInputCheckbox(),
      'created_at'              => new sfWidgetFormDateTime(),
      'updated_at'              => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                      => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'staff_id'                => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Staff'))),
      'old_gov_organization_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('OldGovOrganization'))),
      'new_gov_organization_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('NewGovOrganization'))),
      'old_job_title'           => new sfValidatorString(array('max_length' => 100)),
      'new_job_title'           => new sfValidatorString(array('max_length' => 100)),
      'start_date'              => new sfValidatorDate(),
      'document_id'             => new sfValidatorString(array('max_length' => 100)),
      'is_active'               => new sfValidatorBoolean(array('required' => false)),
      'created_at'              => new sfValidatorDateTime(),
      'updated_at'              => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('staff_transfer[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'StaffTransfer';
  }

}
